const App = {
  mixins: [Query],
  data() {
    return {
      page: {
        value1: "",
        PageNumber: 1,
        RowAmount: 10,
        Condition: window.btoa(unescape(encodeURIComponent("%%"))),
      }
    };
  },
  mounted() {
  },
  methods: {
    // 添加处理下属组织的方法
    handleSubOrganization(row) {
      window.location.href = "./memberAdd.html?action=Modify&Organization_SerialNumber=" + row.Organization_SerialNumber;
    },
    validateAllForms() {
      return new Promise((resolve) => {
        this.$refs.form.validate(valid => resolve(valid))
      });
    },    

    postgetList() {
      const _this = this;
      $.ajax({
        headers: requestHeaders(),
        url: `${mh}/generalBusiness/generalQueryForObtainingTrees`,
        type: "GET",
        data: {
          TableName: "north_organization",
        },
        success: (data) => {

          console.log(data);
          _this.Tabletdata=data;
          
        },
        error: (xhr) => console.error("组织树加载失败", xhr)
      });
    },

    // 添加组织
    addOrganization() {
      window.location.href = "./add.html?action=Add";
    },

    // 编辑组织
    handleEdit(row) {
      window.location.href = "./add.html?action=Modify&nodeKey=" + row.Organization_SerialNumber;
    },

    // 查询
    check() {
      this.page.PageNumber = 1;
      this.postgetList();
    },

    // 分页大小变化
    handleSizeChange(newSize) {
      this.page.RowAmount = newSize;
      this.postgetList();
    },

    // 当前页变化
    handleCurrentChange(newPage) {
      this.page.PageNumber = newPage;
      this.postgetList();
    }
  }
};

const { createApp } = Vue;
const app = createApp(App);

// 注册图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.use(ElementPlus, { locale: zhCn });
app.mount("#app");